﻿<Window x:Class="HistorianView.ExportDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Export Data To File" SizeToContent="WidthAndHeight" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" Icon="/HistorianView;component/jar_view.ico">
    <Grid Margin="10">
        <Grid.Resources>
            <Style x:Key="CellStyle" TargetType="FrameworkElement">
                <Setter Property="Margin" Value="0,5" />
                <Setter Property="VerticalAlignment" Value="Center" />
            </Style>
        </Grid.Resources>
        
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Label Grid.Row="0" Grid.Column="0" Content="File Format" Style="{StaticResource CellStyle}" />
        <ComboBox Name="FileTypeComboBox" Grid.Row="0" Grid.Column="1" Width="200" HorizontalAlignment="Left" SelectedIndex="0" Style="{StaticResource CellStyle}" SelectionChanged="FileTypeComboBox_SelectionChanged">
            <ComboBoxItem>Comma Separated Values (CSV)</ComboBoxItem>
            <ComboBoxItem>COMTRADE (ASCII)</ComboBoxItem>
            <ComboBoxItem>COMTRADE (Binary)</ComboBoxItem>
        </ComboBox>

        <Label Grid.Row="1" Grid.Column="0" Content="Frame Rate" Style="{StaticResource CellStyle}" />
        <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Style="{StaticResource CellStyle}">
            <TextBox Name="FrameRateTextBox" Width="50" HorizontalContentAlignment="Right" Text="30" TextChanged="FrameRateTextBox_TextChanged" />
            <Label Content="frames per second" />
        </StackPanel>
        
        <Label Grid.Row="2" Grid.Column="0" Content="Time Resolution" Style="{StaticResource CellStyle}" />
        <StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" Style="{StaticResource CellStyle}">
            <TextBox Name="TimeResolutionTextBox" Width="75" Text="330000" TextChanged="TimeResolutionTextBox_TextChanged" />
            <Button Name="RecommendedTimeResolutionButton" Margin="10,0,0,0" Content="Recommended: 330000" Click="RecommendedTimeResolutionButton_Click" />
        </StackPanel>
        
        <Label Name="NominalFrequencyLabel" Grid.Row="3" Grid.Column="0" Content="Nominal Frequency" Style="{StaticResource CellStyle}" Visibility="Collapsed" />
        <StackPanel Name="NominalFrequencyStackPanel" Grid.Row="3" Grid.Column="1" Orientation="Horizontal" Style="{StaticResource CellStyle}" Visibility="Collapsed">
            <TextBox Name="NominalFrequencyTextBox" Width="50" HorizontalContentAlignment="Right" Text="60" TextChanged="NominalFrequencyTextBox_TextChanged" />
            <Label Content="Hz" />
        </StackPanel>
        
        <CheckBox Name="AlignTimestampsCheckBox" Grid.Row="4" Grid.Column="1" Content="Align timestamps" IsChecked="True" Style="{StaticResource CellStyle}" Checked="AlignTimestampsCheckBox_Checked" Unchecked="AlignTimestampsCheckBox_Unchecked" />

        <StackPanel Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right" Style="{StaticResource CellStyle}">
            <StackPanel.Resources>
                <Style TargetType="Button">
                    <Setter Property="Margin" Value="5, 0" />
                    <Setter Property="Width" Value="80" />
                    <Setter Property="Height" Value="25" />
                </Style>
            </StackPanel.Resources>

            <Button Content="Export" IsDefault="True"  Click="ExportButton_Click" />
            <Button Content="Cancel" IsCancel="True" />
        </StackPanel>
    </Grid>
</Window>
